import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from time import sleep
driver=webdriver.Firefox()
driver.get('https://www.jiuxian.com/')
time.sleep(2)

sousuo=driver.find_element(By.XPATH,'//input[@id="wd" and @class="search-form"]')
sousuo.send_keys('茅台')
sousuo.send_keys(Keys.ENTER)
time.sleep(5)

ss=driver.find_element(By.LINK_TEXT,'默认排序').text
print(ss)

driver.find_element(By.XPATH,'//a[@href="/search.htm?v=2&key=%E8%8C%85%E5%8F%B0&cg=1&area=2"]').click()
time.sleep(5)

bj=driver.find_element(By.CLASS_NAME,'type').text
print(bj)

driver.find_element(By.XPATH,'/html/body/div[6]/div/div[2]/div[3]/div[2]/div[2]/ul/li[1]/a').click()
time.sleep(5)

driver.find_element(By.XPATH,'/html/body/div[6]/div/div[2]/div[6]/ul/li[1]/div[2]/div[1]/a/img').click()
time.sleep(5)

driver.switch_to.window(driver.window_handles[-1])
time.sleep(5)

driver.find_element(By.NAME,'detail_jiarugouwuche').click()
time.sleep(5)

driver.find_element(By.XPATH,'//a[@href="https://cart.jiuxian.com/"]').click()
time.sleep(5)

gwc=driver.find_element(By.CLASS_NAME,'on').text
print(gwc)
driver.quit()